.TH "ggiGetGamma" 3 "2007-12-17" "libggi-current" GGI
.SH NAME
\fBggiGetGamma\fR, \fBggiSetGamma\fR, \fBggiGetGammaMap\fR, \fBggiSetGammaMap\fR, \fBggiGammaMax\fR : Manipulate the gamma maps and the gamma correction of a visual
.SH SYNOPSIS
.nb
.nf
#include <ggi/ggi.h>

int ggiGetGamma(ggi_visual_t vis,
                      double *r, double *g, double *b);

int ggiSetGamma(ggi_visual_t vis,
                      double r, double g, double b);

int ggiGetGammaMap(ggi_visual_t vis,
                      int s, int len, ggi_color *gammamap);

int ggiSetGammaMap(ggi_visual_t vis,
                      int s, int len, const ggi_color *gammamap);

int ggiGammaMax(ggi_visual_t vis,
                      uint32_t bitmeaning, int *max_r, int *max_w);
.fi

.SH DESCRIPTION
Some modes on some hardware can use a per-channel palette to lookup
the values before sending to the monitor.  Generally this is used for
gamma correction by filling the lookup table with a curve, hence the
name "gamma map", but it could be used for other things e.g. special
effects in games.  Truecolor modes with gamma maps are sometimes
referred to as "directcolor".

\fBggiSetGammaMap\fR and \fBggiGetGammaMap\fR set or get the gamma map, for
\fIlen\fR colors starting at \fIs\fR.  In the event that there are more
map entries for some channels than others, values for the upper
indices of the map in the shallow channels are ignored on write, and
undefined on read.

The \fBggiGammaMax\fR function is used in order to find out how many
readable and writeable entries are in the map (returned in the
integers referenced by \fImax_w\fR and \fImax_r\fR).  This must be
done once for each channel.  The parameter \fIbitmeaning\fR should be
set to the bit meaning (e.g. \fBGGI_BM_TYPE_COLOR\fR | \fBGGI_BM_SUB_BLUE\fR) of
the channel of which you are inquiring.  If \fBggiGammaMax\fR returns an
\f(CWgg-error(3)\fR, you cannot set the gamma map on this visual. 
If \fBggiGammaMax\fR succeeds, but \fImax_w\fR is -1 on return, this means
that \fBggiSetGamma\fR will work, but that \fBggiSetGammaMap\fR will not.

\fBggiSetGamma\fR and \fBggiGetGamma\fR sets or gets the gamma correction for
the visual according to the usual curve associated with the given
values for each channel, which should be positive.
.SH RETURN VALUE
All five functions \fB0\fR for OK, otherwise a \f(CWgg-error(3)\fR code.
